import * as types from '../../mutation-types'

const initMenu = {
  buttonList: [],
  menuList: [],
  currentPageTitle: ''
}
const menuReducer = (preState = initMenu, action) => {
  const { type, data } = action
  switch (type) {
    case types.SET_MENU_LIST:
      return {
        ...preState,
        menuList: data
      };
    case types.SET_PAGE_TITLE:
      return {
        ...preState,
        currentPageTitle: data
      }
    default:
      return preState
  }
}

export default menuReducer